import {QueryParams, QueryRes, SaveParams, SaveRes} from "@/api/passenger/type.ts";
import request from "@/utils/request.ts";
import {Result} from "@/api/Result.ts";


/**
 * 查询乘客列表
 * @param {object} params PassengerQueryReq
 * @param {number} params.id
 * @param {number} params.memberId
 * @param {string} params.name
 * @param {string} params.idCard
 * @param {string} params.type
 * @param {object} params.createTime
 * @param {object} params.updateTime
 * @returns
 */
export function queryList(params: QueryParams): Promise<QueryRes> {
    return request.post(`/member/passenger/quest-list`, params);
}


/**
 * 删除乘客信息
 * @param {string} id
 * @returns
 */
export function deleteById(id: number): Promise<Result<any>> {
    return request.delete(`/member/passenger/delete/${id}`);
}

/**
 * 保存乘客信息
 * @param {object} params PassengerSaveReq
 * @param {string} params.name
 * @param {string} params.idCard
 * @param {string} params.type
 * @returns
 */
export function save(params: SaveParams): Promise<SaveRes> {
    return request.post(`/member/passenger/save`, params);
}
